Coding Tips V1.2.2:
1. We add GetDefaultCalibration() method, which used for get default calibration X,Y.
Code logic:
    a) Getting from hardware. Return if yes, otherwise,
    b) Getting from pre-calibration data. Return if yes, otherwise,
    c) Return default X,Y

    Sample codes:
    int defaults[2] = {0,0};
    GetDefaultCalibration(defaults);
    EloUVCCameraConverter::setOffset(defaults[0], defaults[1]);
			
    For early version of IRKit, we strongly recommand ISV do manual calibration rather than using default X,Y


2. We add SetThreshold(), interface for threshold adjustment.
* Default thershold is 0.8f, 0.8f, 0.6f (values are different from Android Version!!!)
You can set threshold of face tracking algorithm now. Decrease threshold can increase possibility of finding facing. But it will increase false negative (FN) as well. 
    Sample codes in SmartWidget:
    SetThreshold(0.5f,0.5f,0.5f);


      

3. We add SetCameraLightParameter(), using for low-lux environment. (values are different from Android Version!!!)
The higher value leads to the brighter(more white) image.

For example:

    SetCameraLightParameter(0, 1, 100); //Reset to default in normal environment

    Or,

    SetCameraLightParameter(64, 3, 300); //setting brightness, backlightComp and gamma, in dark environment.


Coding Tips V1.2.1:
1. In order to use new feature, firmware update in required.
The path of TCM's firmware is under firmware/IR V1.21 210120.bin.

2. SoftResetTCM() can be used if sensor is malfunctional.

3. A whole machine power off/on is required after firmware update, please do not use SoftResetTCM() instead.


Coding Tips V1.1.0:
1. What's new in firmware of TCM V1.1? Do I need to update firmware?

The firmware of TCM V1.1 includes calibartion data saving (offsetX and offsetY).

If you are working well and do the calibration by your own, you don't have to update the firmware.
If you want to save/load the calibration data between AIOs, you can consider upgrading the firmware.

* Please notice: In SDK 1.0.1 and before, the cabibration data is saved on values of application. 
Therefore, if you re-install application or move IR Kit to another AIO will lead to an extra calibration.


2. How to update firmware if I have an older Kit?
The IR Kit in DVT stage or later supports firmware upgrade.
The path of TCM's firmware is under firmware/IR V1.1b.bin.

Reference code (see in testwidget.cpp):

    QFileDialog *fileDialog = new QFileDialog(this);
    fileDialog->setWindowTitle(tr("Open File"));
    fileDialog->setDirectory(".");
    fileDialog->setNameFilter(tr("Firmware Files(*.bin)"));
    if(fileDialog->exec() == QDialog::Accepted) {
        QString path = fileDialog->selectedFiles()[0];
        if (path.isEmpty() == false) {
            QFile file (path);
            bool isOk = file.open(QIODevice::ReadOnly);
            if (isOk)
            {
                QByteArray array = file.readAll();
                int length = array.size();
                char* firm = array.data();
                SetFirmwareData((const unsigned char*)firm, length);
                file.close();

                StartUpdate();
            }
        }
    }

Callback:
    SetUpdateCallback(onUpdate);
			
    void TestWidget::onUpdateCallback(bool isSuc, int prog) {
        if (isSuc) {
            emit updateLabel(_txTCMVersion, QString::asprintf("Update:%d Suc", prog));
        }
        else {
            emit updateLabel(_txTCMVersion, QString::asprintf("Update:%d Fail", prog));
        }
}

* "isSuc == true and prog == 100" means update successfully.

Important!!
a) Please DO NOT disconnect or power off IR Kit when you are updating firmware (prog != 100).
b) No matter the update is successful or not, you are required to switch off/on the whole machine to make changes valid. (Power off entire AIO and IR Kit, then power on).


3. How to use feature: store/load calibration data on hardware (available on TCM version:V1.1 201117 or above)
If IR kit on your side is V1.1 already, you can use this feature already. The calibration data is preseted. (640*480 resolution).
If you are updating to V1.1, you are required to save data at the first time, 


void TestWidget::on_btnSavePreset_clicked()
{
    QString serial = _txSerial->text();
    if (serial.length() == 0) {
        QMessageBox::information(NULL, tr("Warn"), tr("Serial empty!"));
        return;
    }
    else if (serial.length() > 12) {
        QMessageBox::information(NULL, tr("Warn"), tr("Serial too long!"));
        return;
    }

    QByteArray arr;
    arr.append(serial);
    const char *str = arr.data();
    bool isOK = UpdatePreset(EloUVCCameraConverter::getOffsetX(),
                             EloUVCCameraConverter::getOffsetY(),
                             str);

    if (isOK) {
        QMessageBox::information(NULL, tr("Warn"), tr("Save success!"));
    }
    else {
        QMessageBox::information(NULL, tr("Warn"), tr("Save failed!"));
    }
}




Then, you can get data via method

    int x, y;
    bool hasPreset = HasPreset();
    if (hasPreset) {
        x = GetPresetOffsetX();
        y = GetPresetOffsetY();
        char serial[50] = {0};
        GetPresetSerial(serial);
        emit updateEdit(_txSerial, QString::asprintf("%s", serial));

    }
    else {
        x = EloUVCCameraConverter::getOffsetX();
        y = EloUVCCameraConverter::getOffsetY();
    }
    EloUVCCameraConverter::setOffset(x, y);
    updateOffset();


4. What's limit notification?
Limit notification is a notification which indicate the motor is reached to the bottom of the IR Kit, or gives a zero-point of the angle of rotation.

You can add code like this:

    SetLimitEventListener(onLimit);


